<!DOCTYPE html>
<html lang="" data-dpr="1" class=" " data-theme="light" style="font-size: 37.5px;">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link rel="icon" href="/favicon.ico">
    <link href="/static/home/css/profit.css" rel="stylesheet">
    <title>{$page_title}</title>
</head>
<body style="font-size: 12px;">
<div id="app">
    <div class="main">
        <div class="top">
            <div onClick="javascript :history.back(-1);" class="back">
                <img class="" src="/static/home/image/back.png" />
            </div>
            <div class="title">
                质押/解押列表
            </div>
        </div>
        <div class="card">
            <div class="van-tabs van-tabs--line">
                <div class="van-tabs__wrap">
                    <div class="van-tabs__nav van-tabs__nav--line" style="border-color: rgb(115, 40, 236); background: transparent;">
                        <div class="van-tab active"  style="color: rgba(255, 255, 255, 255);">
                            <span class="van-tab__text van-tab__text--ellipsis">质押记录</span>
                        </div>
                        <div class="van-tab" style="color: rgba(255, 255,255, 0.51);">
                            <span class="van-tab__text van-tab__text--ellipsis">解押记录</span>
                        </div>
                        <div class="van-tabs__line" style="background-color: rgb(115, 40, 236); transform: translateX(266.5px) translateX(-950%);"></div>
                    </div>
                </div>
                 <!--质押 start-->
                <div class="van-tabs__content pledge_content van-tabs__content--animated">
                    <div class="van-tabs__track" style="transform: translate3d(-100%, 0px, 0px); transition-duration: 0.3s;">
                        <div aria-hidden="true" class="van-tab__pane-wrapper van-tab__pane-wrapper--inactive" >
                            <div class="van-tab__pane" ></div>
                        </div>
                        <div class="van-tab__pane-wrapper" >
                            <div class="van-tab__pane" >
                                <div class="content" >
                                    <div class="van-pull-refresh" >
                                        <div class="van-pull-refresh__track" style="transition-duration: 0ms;">

                                            <div class="van-list no_pledge_list">
                                                <div class="item">
                                                    <div class="ttxt">质押数量</div>
                                                    <div class="ttxt">状态</div>
                                                </div>
                                                <div class="noData">
                                                    <img style="width: 50%;" src="/static/home/image/nodata.png">
                                                </div>
                                                <div class="van-list__finished-text">
                                                    没有更多了
                                                </div>
                                                <div class="van-list__placeholder"></div>
                                            </div>

                                            <div style="display: none" class="van-list pledge_list">
                                                <div class="item">
                                                    <div class="ttxt">质押数量</div>
                                                    <div class="ttxt">状态</div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!--质押 end-->
                <!--解押 start-->
                <div style="display: none" class="van-tabs__content rele_pledge_content van-tabs__content--animated">
                    <div class="van-tabs__track" style="transform: translate3d(-100%, 0px, 0px); transition-duration: 0.3s;">
                        <div role="tabpanel" aria-hidden="true" class="van-tab__pane-wrapper van-tab__pane-wrapper--inactive" >
                            <div class="van-tab__pane" ></div>
                        </div>
                        <div class="van-tab__pane-wrapper" >
                            <div class="van-tab__pane" >
                                <div class="content" >
                                    <div class="van-pull-refresh" >
                                        <div class="van-pull-refresh__track" style="transition-duration: 0ms;">
                                            <div class="van-list no_rele_pledge_list">
                                                <div class="item">
                                                    <div class="ttxt">解押数量</div>
                                                    <div class="ttxt">状态</div>
                                                </div>
                                                <div class="noData">
                                                    <img style="width: 50%;" src="/static/home/image/nodata.png">
                                                </div>
                                                <div class="van-list__finished-text">
                                                    没有更多了
                                                </div>
                                                <div class="van-list__placeholder"></div>
                                            </div>

                                            <div style="display: none"  class="van-list rele_pledge_list">
                                                <div class="item">
                                                    <div class="ttxt">数量</div>
                                                    <div class="ttxt">状态</div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!--解押 end-->
            </div>
        </div>
        <div class="buttoms">{:config("dbconfig.sys.copyright")}</div>
    </div>
</div>

<script src="/static/home/js/jquery-1.9.1.js"></script>
<script>
    $(function () {
        let address = "{$address}";
        let page = 0;
        let is_bottom = 0;
        let rele_page = 0;
        let rele_is_bottom = 0;
        let acitve = 1;

        pledgeList();
        relePledgeList();
        window.addEventListener('scroll', function(){
            if(window.pageYOffset + window.innerHeight >= document.documentElement.scrollHeight) {
                if(acitve == 2){
                    relePledgeList();
                }else{
                    pledgeList();
                }

            }
        });
        //质押列表
        function pledgeList(){
            if(is_bottom == 1 || typeof address === 'undefined' || address == ''){
                return;
            }
            page += 1;
            $.ajax({
                type:'post',
                url:"/home/Pledge/loglist",
                data:{address:address,page:page,type:1},
                dataType:'json',
                success:function(res){
                    if(res.status == 1){
                        is_bottom = res.data.is_bottom;
                        var list = res.data.list;
                        var html = '';
                        for (var i=0; i < list.length; i++){
                            html += '<div class="item">';
                            html += '<div class="lines">';
                            html += ' <div class="left">'+list[i]['money']+'</div>';
                            html += ' <div class="time">'+list[i]['c_time']+'</div></div><div>';
                            if(list[i]['status'] == 1){
                                html += '<div style="color:#7328ec" class="right">成功</div>';
                            }else if(list[i]['status'] == 2){
                                html += '<div class="right">失败</div>';
                            }else{
                                html += '<div style="color:red" class="right">处理中</div>';
                            }
                            html += '</div></div>';
                        }
                        $(".pledge_list").append(html);
                        if($('.pledge_list').children(".item").length > 1){
                            $(".no_pledge_list").hide();
                            $(".pledge_list").show();
                        }
                    }
                },
                error: function(e){
                },
            });
        }

        //解押列表
        function relePledgeList(){
            if(rele_is_bottom == 1 || typeof address === 'undefined' || address == ''){
                return;
            }
            rele_page += 1;
            $.ajax({
                type:'post',
                url:"/home/Pledge/loglist",
                data:{address:address,page:rele_page,type:2},
                dataType:'json',
                success:function(res){
                    if(res.status == 1){
                        rele_is_bottom = res.data.is_bottom;
                        var list = res.data.list;
                        var html = '';
                        for (var i=0; i < list.length; i++){
                            html += '<div class="item">';
                            html += '<div class="lines">';
                            html += ' <div class="left">'+list[i]['money']+'</div>';
                            html += ' <div class="time">'+list[i]['c_time']+'</div></div><div>';
                            if(list[i]['status'] == 1){
                                html += '<div style="color:#7328ec" class="right">成功</div>';
                            }else if(list[i]['status'] == 2){
                                html += '<div class="right">失败</div>';
                            }else{
                                html += '<div style="color:red" class="right">处理中</div>';
                            }
                            html += '</div></div>';
                        }
                        $(".rele_pledge_list").append(html);
                        if($('.rele_pledge_list').children(".item").length > 1){
                            $(".no_rele_pledge_list").hide();
                            $(".rele_pledge_list").show();
                        }
                    }
                },
                error: function(e){
                },
            });
        }

        $(".van-tab").click(function () {
            var index = $(".van-tab").index(this);
            $(".van-tab").css("color","rgba(255, 255, 255, 0.51)");
            $(".van-tab").removeClass("active");
            $(this).css("color","rgba(255, 255, 255, 255)");
            $(this).addClass("active");
            if(index == 0 && $('.pledge_content').css('display') == 'none'){
                acitve = 1;
                $(".rele_pledge_content").hide();
                $(".van-tabs__nav .van-tabs__line").css('transform','translateX(266.5px) translateX(-950%)');
                $(".pledge_content").slideToggle();
            }else if(index == 1 && $('.rele_pledge_content').css('display') == 'none'){
                acitve = 2;
                $(".pledge_content").hide();
                $(".van-tabs__nav .van-tabs__line").css('transform','translateX(266.5px) translateX(-50%)');
                $(".rele_pledge_content").slideToggle();
            }
        });
    })
</script>
</body>
</html>